<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>QQ号查询手机</title>
    <!-- jquery cdn -->
    <script src="js/jquery.min.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap-grid.css" rel="stylesheet">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css"
          integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="tabbable" id="tabs-391760">
                <ul class="nav nav-tabs">
                    <li class="active">
                        <a href="#panel-193072" data-toggle="tab">首页</a>
                    </li>
                    <li>
                        <a href="#panel-512502" data-toggle="tab">简介</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="panel-193072">
                        <form role="form">
                            <div class="form-group">
                                <label for="qq">QQ号:</label>
                                <input type="text" class="form-control" id="qq"/>
                            </div>
                        </form>
                        <button class="btn btn-default" onclick="sendQQ()">确定</button>
                        <div id="resultShow" style="display: none">
                            <h2>
                                查询结果
                            </h2>
                            <div>
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>
                                            编号
                                        </th>
                                        <th>
                                            手机号
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody id="textShow">

                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="alert alert-success alert-dismissable" id="noResult"
                             style="display: none;margin-top: 20px;">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4>
                                注意!
                            </h4> <strong>Warning!</strong> 这里没有你的数据，你的隐私保护的很好！
                        </div>
                    </div>
                    <div class="tab-pane" id="panel-512502">
                        <p>
                            此测试接口为柳传志亲自提供，在此深表感谢！<br>
                            获取的数据不得用作商业、违法等用途！
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function sendQQ() {
        var qq = $("#qq").val();
        console.log(qq);
        $.ajax({
            url: "/mr/qq",
            type: 'get',
            dataType: 'json',
            data: {
                qq: qq
            },
            success: function (data) {
                console.log(data.qq.res);
                if (data.qq.status === "true") {
                    $("#noResult").css('display', 'none');
                    $("#resultShow").css('display', 'block');
                    var apiResult = data.qq.res;
                    var page = "";
                    for (var i = 0; i < apiResult.length; i++) {
                        page += "<tr>\n" +
                            "                            <td>\n" +
                            i +
                            "                            </td>\n" +
                            "                            <td>\n" +
                            apiResult[i].phone +
                            "                            </td>\n" +
                            "                        </tr>";
                    }
                    $('#textShow').html(page);
                } else {
                    $("#resultShow").css('display', 'none');
                    $("#noResult").css('display', 'block');
                }
            }
        })
    }
</script>
</html>